import React, { useState } from "react";
import styles from "./index.module.css";
import { ResultPage, Card, Switch ,Button} from "antd-mobile";
import { Exchange } from "@react-vant/icons";
import { useSelector, useDispatch } from "react-redux";
import { useNavigate } from "react-router-dom";
function Index() {
  const { date, start, end } = useSelector((state) => state.CitySlice);
  const dispatch = useDispatch();
  const [isdeep, useIsdeep] = useState(false);
  const navigate=useNavigate()
  const handleToList=()=>{
    navigate(`/list?isdeep=${isdeep}`)
  }
  return (
    <div>
      <ResultPage status="" title="操作成功" description="内容详情可折行">
        <Card>
          <div className={styles.home_city}>
            <span>{start}</span>
            <Exchange />
            <span>{end}</span>
          </div>

          <div className={styles.home_time}>
            <span>{date}</span>
          </div>

          <div className={styles.home_switchkg}>
            <Switch checked={isdeep}></Switch>
            <span>高铁/火车</span>
          </div>
          <Button block color="primary" size="large" onClick={()=>handleToList()}>
           查询车票
          </Button>
        </Card>
      </ResultPage>
    </div>
  );
}

export default Index;
